
let hotCourse = '/api/home/get_hot_course';

let courseDetails = `/api/home/get_course_byid/`;

let allCourses = '/api/home/get_course_page';

let levelOne = '/api/home/get_courseLevel_list';

let registerUrl = '/api/user/user_register';

let captchaUrl = '/api/user/get_phone_val';

let searchNameUrl = '/api/home/search_course_list';

let loginUrl = '/api/user/user_login';

let captchaLoginUrl = '/api/user/user_login_phone';

let carouselUrl = '/api/home/get_myBanner_list';

let userInfoUrl = '/api/myuser/get_login_user';

let modifyPasswordUrl = '/api/myuser/update_user_pass';

let nocertificateUrl = '/api/online/get_not_exam_all';

let certificateUrl = '/api/online/get_yes_exam_all';

let modifyPhoneUrl = '/api/myuser/update_user_phone';

let imageUploadUrl = '/fileInput/tengxun';

let critiqueCourseUrl = '/api/home/get_courese_rise_all/';

let courseCatalogUrl = '/api/home/get_courese_list_all/';

let modifyNameUrl = '/api/myuser/update_user_msg';

let orderList = '/api/myuser/get_user_certificate_order';

let ccieUpUrl = '/api/myuser/add_user_certificate';

let appllicationUrl = '/api/online/add_exam_user';

let islikeUrl = '/api/myuser/is_like_collect/';

let isdzUrl = '/api/myuser/add_course_like/';

let isscUrl = '/api/myuser/add_course_collect/';

let myRegistrationUrl = '/api/online/find_user_exam';

let examtopicsUrl = '/api/online/get_my_examList_all/'

const install = (Vue, vm) => {
	// 获取热门课程信息
	let gethotCourse = (params = {}) => vm.$u.get(hotCourse, {
	
	});
	
	// 根据ID获取课程详情
	let getCourseDetails = (params = {}) => vm.$u.get(courseDetails+params.id, {});
	
	// 所有课程
	let getAllCourses = (params = {}) => vm.$u.get(allCourses,params);
	
	// 一级分类
	let getlevelOne = (params = {}) => vm.$u.get(levelOne,{});
	
	// 注册
	let getregister = (params = {}) => vm.$u.post(registerUrl,params);
	
	// 获取验证码
	let getcaptcha = (params = {}) => vm.$u.post(captchaUrl,params);
	
	//根据名字搜索
	let getsearchName = (params = {}) => vm.$u.get(searchNameUrl,params);
	
	// 密码登录
	let getloginPas = (params = {}) => vm.$u.post(loginUrl,params);
	
	// 验证码登录
	let getcaptchaLogin = (params = {}) => vm.$u.post(captchaLoginUrl,params);
	
	// 轮播图
	let getcarousel = (params = {}) => vm.$u.get(carouselUrl,params);
	
	// 获取个人信息
	let getUserInfo = (params = {}) => vm.$u.get(userInfoUrl,{});
	
	// 修改密码
	let getmodifyPassword = (params = {}) => vm.$u.post(modifyPasswordUrl,params);
	
	// 还没有得证书
	let getNoCertificate = (params = {}) => vm.$u.get(nocertificateUrl,{});
	
	// 以获得的证书
	let getCertificate = (params = {}) => vm.$u.get(certificateUrl,{});
	
	// 换绑手机号
	let getmodifyPhone = (params = {}) => vm.$u.post(modifyPhoneUrl,params);
	
	//上传图片
	let getimageUpload = (params = {}) => vm.$u.post(imageUploadUrl,params);
	
	// 课程评论
	let getcritiqueCourse = (params = {}) => vm.$u.get(critiqueCourseUrl+params.id,{});
	
	// 课程目录
	let getcourseCatalog = (params = {}) => vm.$u.get(courseCatalogUrl+params.id,{});
	
	// 修改昵称
	let getmodifyName = (params = {}) => vm.$u.post(modifyNameUrl,params);
	
	//获取用户证书订单
	let getorderList = (params = {}) => vm.$u.get(orderList,{});
	
	// 用户证书上传
	let getccieUp = (params = {}) => vm.$u.post(ccieUpUrl,params);
	
	// 用户报名
	let getappllication = (params = {}) => vm.$u.post(appllicationUrl,params);
	
	// 是否点赞收藏
	let getislike = (params = {}) => vm.$u.get(islikeUrl+params.id,{});
	
	// 是否点赞
	let getisdz = (params = {}) => vm.$u.get(isdzUrl+params.id+'/'+params.flag,{});
	
	// 是否收藏
	let getissc = (params = {}) => vm.$u.get(isscUrl+params.id+'/'+params.flag,{});
	
	// 获取我的报名
	let getmyRegistration = (params = {}) => vm.$u.get(myRegistrationUrl,{});

	// 考试题目
	let getexamtopics = (params = {}) => vm.$u.get(examtopicsUrl+params.id,{});
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {gethotCourse,
	getCourseDetails,
	getAllCourses,
	getlevelOne,
	getregister,
	getcaptcha,
	getsearchName,
	getloginPas,
	getcaptchaLogin,
	getcarousel,
	getUserInfo,
	getmodifyPassword,
	getNoCertificate,
	getCertificate,
	getmodifyPhone,
	getimageUpload,
	getcritiqueCourse,
	getcourseCatalog,
	getmodifyName,
	getorderList,
	getccieUp,
	getappllication,
	getislike,
	getisdz,
	getissc,
	getmyRegistration,
	getexamtopics
	};
}

export default {
	install
}